package com.kuangstudy.array;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName: Application
 * date: 2021/7/10/010
 *
 * @author zlk
 */
public class Demo {
    public static void main(String[] args) {
       int[] a = {1,2,3,4,5};
        int[] reverse = reverse(a);
        for (int i : reverse) {
            System.out.println(i);
        }
    }
    /*数组反转*/
    public static int[] reverse(int[] a){
        int[] result = new int[a.length];
        for (int i = 0,j = a.length-1; i < a.length; i++,j--) {
            result[j] = a[i];
        }
        return result;
    }
}
